# -*- coding:utf-8 -*-
"""
配置（读取配置）文件
1、数据库配置缓存，避免频繁访问数据库
2、配合变动通知，主动更新缓存 post方法
3、支持定时读取配置文件（llt配置）
4、读写锁 Successfully installed readerwriterlock==1.0.9
"""
from datetime import datetime
import time
from dateutil import tz
# datetime.strptime(date_string, format)
def time_delta(date_string,format,timezone='Asia/Shanghai'):
    tz_timezone = tz.gettz(timezone)
    datetime_1 = datetime.strptime(date_string,format)
    appointment_year = datetime_1.year
    appointment_month = datetime_1.month
    appointment_day = datetime_1.day
    appointment_hour = datetime_1.hour
    appointment_minute = datetime_1.minute
    appointment_second = datetime_1.second
    appointment_microsecond = datetime_1.microsecond
    appointment_tzinfo = datetime_1.tzinfo
    appointment_isoweekday = datetime_1.isoweekday()
    print(appointment_year,appointment_month,appointment_day,appointment_hour,appointment_minute,appointment_second,appointment_microsecond,appointment_isoweekday,appointment_tzinfo)
    datetime_2 = datetime(appointment_year, appointment_month, appointment_day, appointment_hour , appointment_minute , appointment_second,appointment_microsecond , tz_timezone)
    print(datetime_2,datetime_2.tzinfo)
    # appointment_time =

if __name__ == '__main__':
    date_string = '2022-07-08 01:02:30'
    # tz_sh = tz.gettz('Asia/Shanghai')
    print(date_string)
    time_delta(date_string,'%Y-%m-%d %H:%M:%S')